<?php
include('include/config.inc.php');
if(!isset($_SESSION['s_activId'.$cfgPack])
  || (isset($_SESSION['s_userType'.$cfgPack]) && isset($cfgFileNames['dailyreportmaster'][$_SESSION['s_userType'.$cfgPack]]) 
      && $cfgFileNames['dailyreportmaster'][$_SESSION['s_userType'.$cfgPack]] == 0))
{
  $_SESSION['s_urlRedirectDir'] = $_SERVER['REQUEST_URI'];
  header("Location:checkLogin.php");
}
else
{
  $deleteMaster = "DELETE deliverychallanmaster.*, deliverychallandetail.*, goodsreturn.*
                     FROM deliverychallanmaster
                     JOIN deliverychallandetail ON deliverychallanmaster.deliveryChallanMasterId = deliverychallandetail.deliveryChallanMasterId
                     JOIN goodsreturn ON deliverychallandetail.deliveryChallanDetailId = goodsreturn.deliveryChallanDetailId
	                  WHERE deliverychallanmaster.deliveryChallanMasterId = ".$_GET['deliveryChallanMasterId'];
	$deleteMasterResult = mysql_query($deleteMaster);
	if(!$deleteMasterResult)
	  echo "DELETING FAILED";
  
  header("Location:deliveryChalanList.php");
  exit();
}
?>